﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Ledict.Core.Data;
using System.Data.Common;
using Ledict.ConditionExtract.Common;

namespace Ledict.ConditionExtract.DAL
{
  public  class NewIDDAL
    {
     private  string DbName;
       private  string CommonDbName;
       public NewIDDAL()
       {
          DbName = "JudgeDoc";
          CommonDbName = "LdtCommonManage";
       }

       public string CreateID(string tableName)
       {
           Database oBase = DatabaseFactory.CreateDatabase(CommonDbName);
           DbCommand oCmd = oBase.GetStoredProcCommand("sp_NewId");
           oBase.AddInParameter(oCmd, "@tableName", DbType.String, tableName);

           return LdFormat.ObjectToString(oBase.ExecuteScalar(oCmd).ToString());
       }

       public string JudgeDoc_CreateID(string tableName)
       {
           Database oBase = DatabaseFactory.CreateDatabase(DbName);
           DbCommand oCmd = oBase.GetStoredProcCommand("sp_NewId");
           oBase.AddInParameter(oCmd, "@tableName", DbType.String, tableName);

           return LdFormat.ObjectToString(oBase.ExecuteScalar(oCmd).ToString());
       }



    }
}
